package com.qf.test;

import com.qf.bean.BoyHealth;
import com.qf.bean.GirlHealth;
import com.qf.bean.Student;
import com.qf.dao.StudentDao;
import com.qf.dao.StudentDao2;
import com.qf.util.SessionUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;

/**
 * 2019/11/9
 * Administrator
 * mybatis002
 * 面向对象面向君  不负代码不负卿
 */
public class Demo3 extends SessionUtils {

    //测试鉴别器
    @Test
    public void c1(){
        SqlSession getsession = getsession();
        StudentDao2 studentDao2 = getsession.getMapper(StudentDao2.class);
        List<Student> studentList = studentDao2.findstudents();
        for (Student student : studentList) {
            System.out.println(student.getSname1()+","+student.getSex());
            if(student.getSex().equals("男")){
                BoyHealth boyHealth=(BoyHealth)student;
                List<BoyHealth> boyHealthList = boyHealth.getBoyHealthList();
                for (BoyHealth health : boyHealthList) {
                    System.out.println(health.getSitup());
                }
            }else{
                GirlHealth girlHealth=(GirlHealth)student;
                List<GirlHealth> girlHealthList = girlHealth.getGirlHealthList();
                for (GirlHealth health : girlHealthList) {
                    System.out.println(health.getHeight()+"..."+health.getGirlId());
                }
            }
        }
    }





}


